<html>
<head><meta charset="utf-8"><title>Constify std traits · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Constify.20std.20traits.html">Constify std traits</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247491854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Constify%20std%20traits/near/247491854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> chocolate <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Constify.20std.20traits.html#247491854">(Jul 28 2021 at 17:43)</a>:</h4>
<p>I am experimenting with the const_trait_impl feature. However, I often run into the problem that standard library traits (e.g. Add, Sub, PartialEq) are not const yet. My current workaround is to patch the standard library and compile rustc myself.  Making these traits const (behind a feature flag) seems relatively straightforward, so I was wondering if anyone is working on this already. An example of some code that would be possible if PartialEq would be const: <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=5c25a165af4a4001c23ac704ed65ebdf">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=5c25a165af4a4001c23ac704ed65ebdf</a></p>



<a name="247496944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Constify%20std%20traits/near/247496944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Constify.20std.20traits.html#247496944">(Jul 28 2021 at 18:20)</a>:</h4>
<p>as long as they are made unstably const, we can add them. You should coordinate with <span class="user-mention" data-user-id="361356">@fee1-dead</span> though</p>



<a name="247540867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Constify%20std%20traits/near/247540867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> fee1-dead <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Constify.20std.20traits.html#247540867">(Jul 29 2021 at 03:23)</a>:</h4>
<p>I'm all for that but we need to wait for team decision on <a href="https://github.com/rust-lang/rust/issues/86808">#86808</a> and we also need to wait for the next beta release.</p>



<a name="247564152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Constify%20std%20traits/near/247564152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> chocolate <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Constify.20std.20traits.html#247564152">(Jul 29 2021 at 10:03)</a>:</h4>
<p>OK understood. If you need any help in the future let me know.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>